package com.example.animactivity;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;


public class ScalFragment extends Fragment implements View.OnClickListener {

    private View view;
    private RecyclerView scal_rv;

    public static ScalFragment newInstance() {
        ScalFragment fragment = new ScalFragment();
        Bundle args = new Bundle();

        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.fragment_scal, container, false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        scal_rv = view.findViewById(R.id.scal_rv);
        view.findViewById(R.id.scal_img).setOnClickListener(this);
        scal_rv.setLayoutManager(new LinearLayoutManager(getContext()));
        ArrayList<String> strings = new ArrayList<>();
        for (int i = 0; i < 30; i++) {
            strings.add("item_" + i);
        }
        scal_rv.setAdapter(new ScalAdapter(R.layout.item_scal_layout, strings));
    }

    @Override
    public void onClick(View v) {

    }
}